import time

from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.remote.webdriver import WebDriver


class AddMembers:
    __NAME=(By.ID,"username")
    __ACCOUNT_NUMBER=(By.ID,"memberAdd_acctid")
    __PHONE=(By.ID,"memberAdd_phone")
    __PRESER_BUTTON=(By.CSS_SELECTOR,".js_member_editor_form>div:nth-child(1)>a:nth-child(1)")
    def __init__(self,driver:WebDriver):
        self.driver=driver

    def add_member(self):
        """
        添加成员信息
        :return:
        """
        from src.day36.practice.member_page import Memberpage  #局部导入

        self.driver.find_element(*self.__NAME).send_keys("张三")
        self.driver.find_element(*self.__ACCOUNT_NUMBER).send_keys("zhangsan")
        self.driver.find_element(*self.__PHONE).send_keys("18460050452")
        preservation=self.driver.find_element(*self.__PRESER_BUTTON)
        preservation.click()
        return Memberpage(self.driver)